import axios from "axios";

const API_BASE = "http://localhost:3000/route"; // 根据你的路由调整

// 获取所有任务（不分页）
export const getAllTasks = () => axios.get(API_BASE);

// 分页获取任务
export const getTasksPaged = (page = 1, pageSize = 10) =>
  axios.get(`${API_BASE}/paged`, {
    params: { page, pageSize },
  });

// 获取单个任务
export const getTaskById = (id) => axios.get(`${API_BASE}/${id}`);

// 创建新任务
export const createTask = (taskData) => axios.post(API_BASE, taskData);

// 更新任务
export const updateTask = (id, taskData) =>
  axios.put(`${API_BASE}/${id}`, taskData);

// 删除任务（硬删除）
export const deleteTask = (id) => axios.delete(`${API_BASE}/${id}`);

// 软删除任务
export const softDeleteTask = (id) =>
  axios.patch(`${API_BASE}/${id}/soft-delete`);
